package com.example.sequence.basicJavaKnowledge;

import com.example.sequence.pojo.SeasonEnum;
import com.example.sequence.pojo.SeasonEnum1;
import org.junit.Test;

import static com.example.sequence.pojo.SeasonEnum.SPRING;


public class EnumTest {
    @Test
    public void test1(){
        String summer="SPRING";
        //通过valueOf，获取SUMMER的枚举类型
        SeasonEnum season=SeasonEnum.valueOf(summer);
        //直接初始化使用
        SeasonEnum seasonEnum= SPRING;
        switch (season) {
            case SPRING:
                System.out.println("春天");
                break;
            case SUMMER:
                System.out.println("夏天");
                break;
            case AUTUMN:
                System.out.println("秋天");
                break;
            case WINTER:
                System.out.println("冬天");
                break;
        }
    }
    @Test
    public void test2(){
        //直接初始化
        SeasonEnum1 season1 = SeasonEnum1.SUMMER;
        //调用SeasonEnum枚举类的getChinese()方法获取SPRING的中文值
        System.out.println(season1.getChinese());
    }
}
